<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>

<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";
%>
<!DOCTYPE html>
<html>

<head>
    <base href="<%=basePath%>"/>
    <title>襄阳蓝芯智能化办公系统</title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="stylesheet" type="text/css" href="view/bootstrap-3.3.5/css/bootstrap.css" />
    <link rel="stylesheet" type="text/css" href="view/bootstrapvalidator/css/bootstrapValidator.css" />
    <script charset="utf-8" src="view/jquery/jquery-1.10.2.min.js"></script>
    <script charset="utf-8" src="view/bootstrap-3.3.5/js/bootstrap.js"></script>
    <script charset="utf-8" src="view/bootstrapvalidator/js/bootstrapValidator.js"></script>
</head>
<body>

<div class="panel panel-primary">

    <div class="panel-heading">
        <h4 class="panel-title">发送短消息</h4>
    </div>

    <form action="duanxiaoxi/sendDuanxiaoxi" enctype="multipart/form-data" id="myform" method="post" class="form-horizontal" role="form">
        <div class="panel-body">
            <div class="form-group col-md-12">
                <label for="biaoti" class="col-md-2 control-label">消息主题</label>
                <div class="col-md-8">
                    <input type="text" id="biaoti" name="biaoti" class="form-control"
                           placeholder="请输入主题">
                </div>
            </div>

            <div class="form-group col-md-12">
                <label for="neirong" class="col-md-2 control-label">消息内容</label>
                <div class="col-md-8">
						<textarea class="form-control" id="neirong" name="neirong"
                                  rows="10" placeholder="请输入消息内容"></textarea>
                </div>
            </div>

            <div class="form-group col-md-12">
                <label for="empids" class="col-md-2 control-label">消息接受人</label>
                <div class="col-md-8">
                    <input type="hidden" id="empids" name="empids">
                    <div class="input-group">
							<span class="input-group-btn">
								<button class="btn btn-info" type="button" data-toggle="modal"
                                        data-target="#selectempsModal">请选择</button>
							</span>
                        <input type="text" id="jieshounames" name="jieshounames"
                               readonly="readonly" class="form-control" placeholder="请选择接受人">
                    </div>
                </div>
            </div>

            <div class="form-group col-md-12">
                <label for="file" class="col-md-2 control-label">消息附件(最大20M)</label>
                <div class="col-md-8">
                    <input type="file" id="file" name="file"></input>
                </div>
            </div>

            <div class="form-group col-md-12">
                <div class="col-md-10  col-md-offset-2">
                    <button type="submit" id="editdeptbtn" class="btn btn-success">确认发送</button>
                    <button type="reset" id="resetbtn" class="btn btn-default">清空消息</button>
                </div>
            </div>
        </div>
    </form>
</div>

<%@include file="../modal/selectemp.jsp" %>
<script type="text/javascript">
    function setempvalue(eids, empNames) {
        $("#empids").val(eids);
        $("#jieshounames").val(empNames);
        $("#myform").data('bootstrapValidator').updateStatus('jieshounames', 'NOT_VALIDATED').validateField('jieshounames');
    }

    $(document).ready(function () {
        $("#myform").bootstrapValidator({
            message: 'This value is not valid',
            feedbackIcons: {/*input状态样式图片*/
                valid: 'glyphicon glyphicon-ok',
                invalid: 'glyphicon glyphicon-remove',
                validating: 'glyphicon glyphicon-refresh'
            },
            fields: {
                biaoti: {
                    validators: {
                        notEmpty: {/*非空提示*/
                            message: '消息主题不能为空'

                        },
                        stringLength: {
                            min: 1,
                            max: 50,
                            message: '消息主题长度需在1-50位'
                        }
                    }
                },
                jieshounames: {
                    validators: {
                        notEmpty: {/*非空提示*/
                            message: '请选择消息接受人'

                        }
                    }
                }
            },
            submitHandler: function (validator, form, submitButton) {
                validator.defaultSubmit();
            }
        });

        $("#resetbtn").click(function () {
            $("#emp")[0].options.length = 1;
            $("#myform").data("bootstrapValidator").resetForm();
        });
    });
</script>

</body>
</html>
